﻿using System;
using System.Collections.Generic;

namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System.Web.UI.WebControls.WebParts;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [Serializable]
    [CollaborisClass(
        Title = "Web Part List Information",
        ReleaseStatus = ReleaseStatus.Development,
        Summary = "Defines a set of parameters to list a set of web parts on a page by their ID's."
        )
    ]
    public class WebPartListInfo : WSSEntityBase
    {
        private string webPartPageRelativeUrl;

        private List<string> webPartIds;

        private PersonalizationScope personalizationScope;

        private bool removeAll;

        [CollaborisProperty(
           Summary = "The relative path to the web part page containing the web parts to connect.",
           Title = "Page Name",
           Example = @"pages/Default.aspx",
           InputHint = InputHint.SingleText,
           Required = true)]
        public string WebPartPageRelativeUrl
        {
            get
            {
                return this.webPartPageRelativeUrl;
            }
            set
            {
                this.webPartPageRelativeUrl = value;
            }
        }

        [CollaborisProperty(
         Summary = "A list of web part ID's that will be used by the action to operate on.",
         Title = "Web Part Ids",
         Remarks = "Hint : To discover the web part ID, try exporting it.",
         Example = @"<list element-type=""string"">" +
                   @" <value>MyListViewWebPart</value>" +
                   @"</list>",
         SerializedExample = @"<ArrayOfString type=""System.Collections.Generic.List`1[[System.String]]"">" +
                         @" <string>MyListViewWebPart</string>" +
                         @"</ArrayOfString>"
         )]
        public List<string> WebPartIds
        {
            get
            {
                return this.webPartIds;
            }
            set
            {
                this.webPartIds = value;
            }
        }

        [CollaborisProperty(
         Summary = "Indicates the PersonalizationScope for a WebPartManager " +
                 "object or the PersonalizationScope that applies to a " +
                 "property on a web parts control.",
         Title = "Personalization Scope",
         Example = @"Shared",
         InputHint = InputHint.Enum,
         Required = true)]
        public PersonalizationScope PersonalizationScope
        {
            get
            {
                return this.personalizationScope;
            }
            set
            {
                this.personalizationScope = value;
            }
        }
       
        [CollaborisProperty(
             Summary = "Specifies whether to remove all of the web parts on the web parts page.",
             Title = "Remove All",
             Example = @"false",
             InputHint = InputHint.Boolean,
             Remarks = "If 'True' is supplied then any ID's entered into 'WebPartIds' will be ignored.",
             Required = false)]
        public Boolean RemoveAll
        {
            get
            {
                return this.removeAll;
            }
            set
            {
                this.removeAll = value;
            }
        }
    }
}
